/**
 * @author Mathieu Maret
 * 
 * Contains informations comming from a communication. 
 * A message could have one of the 3 types (Message.NORMAL, Message.DEBUG, Message.ERROR)
 * You could also put the sourceType (ie, EasyAwarnessInput.BLUETOOTH, EasyAwarnessInput.USER ...)
 * and a URL (usualy of a remote device) 
 */
public class Message {

	static int NORMAL = 0;
	static int DEBUG = 1;
	static int ERROR = 2;
	private String message;
	private int sourceType;
	private int type;
	private Object connectionURL;
	private String host;
	private String service;


	
	/**
	 * Create a new message with a content
	 * @param raw the content of the input
	 */
	
	public Message(String raw){
		message = raw;
	}
	
	/**
	 * Create a new Message with a content, a sourceType and a URL 
	 * @param raw the content of the message
	 * @param sourceType The type of the input which generate the message
	 * @param URL The URL (usualy the URL of the remote device where the informations came from)
	 */
	public Message(String raw,int sourceType, Object URL){
		message = raw;
		this.sourceType = sourceType;
		this.connectionURL = URL;
		type = NORMAL;
	}
	
	/**
	 * @return Retrun the Content of a message.
	 */
	public String getContent(){
		return message;
	}
	public int getSize(){
		return message.length();
	}
	public void setContent(String message) {
		this.message = message;
	}
	
	/**
	 * Add the parameter at the end of the content of the message
	 * @param message
	 */
	public void appendContent(String message){
		this.message += message;
	}
	public int getSourceType() {
		return sourceType;
	}
	public void setSourceType(int sourceType) {
		this.sourceType = sourceType;
	}
	public Object getConnectionURL() {
		return connectionURL;
	}
	public void setConnectionURL(Object connectionURL) {
		this.connectionURL = connectionURL;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getHost() {
		return host;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public String getService() {
		return service;
	}
	public void setService(String service) {
		this.service = service;
	}



}
